import pinyin from 'pinyin'

// 中文转拼音
export function zhongWenToPinYin(tableData: ITableDataItem[]) {
  tableData.forEach((item) => {
    const name = item.newest.name
    if (name) {
      const pinyinArr: any[] = pinyin(name, {
        style: 'normal',
        segment: false,
        compact: true
      })

      if (pinyinArr.length > 0) {
        item.newest.name = pinyinArr[0].join('')
      }
    }
  })
}
